import { RouterName } from '../name'
import { mergeMeta } from '../merge-meta'

import { errorRoutes } from './error'
import { postRoutes } from './posts'
import { courseRoutes } from './course'
import { userRoutes } from './user'
import { classRoutes } from './class'
import { Role } from '@/constants/role'

import DefaultLayout from '@/layouts/DefaultLayout.vue'
import LoginPage from '@/pages/LoginPage/index.vue'

export const routes = mergeMeta(
  [
    {
      path: '/login',
      name: RouterName.Login,
      component: LoginPage
    },
    {
      path: '/',
      component: DefaultLayout,
      children: [
        {
          path: '',
          name: RouterName.Home,
          meta: {
            requireAuth: true,
            hideInMenu: false,
            menuTitle: 'navigation.home',
            icon: 'i-fluent-home-more-32-filled'
          },
          component: () => import('@/pages/HomePage/index.vue')
        },
        ...courseRoutes,
        ...classRoutes,
        ...userRoutes,
        ...postRoutes,
        ...errorRoutes
      ]
    }
  ],
  {
    requireAuth: false,
    role: Role.All,
    hideInMenu: true
  }
)
